/*
 * Copyright 2014 Semidata. All rights reserved.
 */
package com.semidata.trp.report.main;

import com.semidata.rtd.core.log.DefaultLogService;
import com.semidata.rtd.core.service.ServiceManager;
import com.semidata.trp.report.config.Config;
import com.semidata.trp.report.service.ReportService;

/**
 * @author shewei@semidata.com, She Wei
 *
 */
public class Main {
	
	public static void main(String[] args) {
		
		String configFile;
        if (args.length > 0) {
            configFile = args[0];
        } else {
            configFile = null;
        }

        try {
            Config.init(configFile);
        } catch (RuntimeException e) {
            System.err.println("can not load config file");
            return;
        }

        Config config = Config.getConfig();
        
        ServiceManager.register(new DefaultLogService(config.getLogRoot(), config.isLogDebugEnabled()));
        ServiceManager.register(new ReportService());
        ServiceManager.startAll();
        ServiceManager.sync();   
	}

}
